local jiliao = fk.CreateSkill {
  name = "jiliao",
  tags = { Skill.Compulsory },
}

Fk:loadTranslationTable{
  ["jiliao"] = "急燎",
  [":jiliao"] = "锁定技，当你于回合内使用【杀】或普通锦囊牌指定其他角色为目标后，你随机展示其一张手牌，若此牌与你使用的牌颜色不同，则你获得之，否则其将此牌当【杀】对你使用。",

  ["$jiliao"] = "急燎",

  ["$jiliao1"] = "此击，可堪十万雄兵！",
  ["$jiliao2"] = "",
}

jiliao:addEffect(fk.TargetSpecified, {
  anim_type = "offensive",
  is_delay_effect = true,
  can_trigger = function(self, event, target, player, data)
    return target == player and player.room.current == player and
    player:hasSkill(jiliao.name) and data.firstTarget and
      (data.card.trueName == "slash" or data.card:isCommonTrick()) and
      table.find(data.use.tos, function(p)
        return p ~= player and not p.dead
      end)
  end,
  on_cost = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local tos = table.filter(data.use.tos, function(p)
      return p ~= player and not p.dead
    end)
    room:sortByAction(tos)
    for _, to in ipairs(tos) do
      if not to.dead and not to:isKongcheng() then
        local Card = table.random(to:getCardIds("h"))
        to:showCards(Card)
        local card = Fk:getCardById(Card)
        if card and card.color == data.card.color then
        local cards = Fk:cloneCard("slash")
        cards:addSubcard(card)
          if to:canUseTo(cards, player, {bypass_distances = true, bypass_times = true}) then
          local use = {
            from = to,
            tos = {player},
            card = cards,
            skillName = jiliao.name,
            extraUse = true,
          }
          room:useCard(use)
          end
        elseif card and card.color ~= data.card.color then
          room:obtainCard(player, card, true, fk.ReasonPrey, player, jiliao.name)
        end
      end
    end
  end,
})

return jiliao
